package main

import (
	"fmt"
	"github.com/biocrosscoder/flex/typed/collections"
	"strings"
)

func reverseString(str string) string {
	stack := collections.NewStack[string](len(str))
	chars := make([]string, len(str))
	var c string
	for _, r := range str {
		c = string(r)
		stack.Push(c)
	}
	for i := 0; i < len(chars); i++ {
		c, _ = stack.Pop()
		chars[i] = c
	}
	return strings.Join(chars, "")
}

func main() {
	strs := []string{
		"hello",
		"Hannah",
	}
	for _, str := range strs {
		fmt.Printf("reversed %s is %s\n", str, reverseString(str))
	}
}
